<!--
@description: 工单中心
@creationTime: 2025-04-15
-->

<route type="page" lang="json5">
{
  layout: 'default',
  style: {
    navigationBarTitleText: '工单中心'
  }
}
</route>

<template>
  <view class="bg-#fff pos-fixed pos-top-none w-100vw z-10">
    <wd-row>
      <wd-col :span="20">
        <wd-search placeholder="请输入工单名称" :hide-cancel="true" />
      </wd-col>
      <wd-col :span="4">
        <view class="flex flex-items-center pt-3">
          <wd-button type="text" size="small" icon="add">添加</wd-button>
        </view>
      </wd-col>
    </wd-row>
    <view class="flex flex-justify-between pr-5">
      <view></view>
      <wd-calendar type="daterange" v-model="value">
        <wd-icon name="view-module" color="#999" size="38rpx"></wd-icon>
      </wd-calendar>
    </view>
    <!-- <NoticeBar></NoticeBar> -->
    <NoticeBar></NoticeBar>
    <wd-tabs v-model="tab">
      <block v-for="item in 4" :key="item">
        <wd-tab :title="`状态${item}`">
          <scroll-view class="h-74vh bg-#f4f6fc pt-1" scroll-y @scrolltolower="handleScrollToLower">
            <TicketCard v-for="(item, index) in tableData" :key="index" :ticketData="item"></TicketCard>
            <Cart></Cart>
          </scroll-view>
        </wd-tab>
      </block>
    </wd-tabs>
  </view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import NoticeBar from './components/NoticeBar.vue'
import TicketCard from './components/TicketCard.vue'
import Cart from './components/Cart.vue'
const tab = ref(0)
const value = ref<number[]>([])
interface Ticket {
  id: number
  workSN: string
  workType: number
  workStatus: number
  workName: string
  workTime: string
  workUser: string[]
  address: string
  isStart: boolean
  client: string
  phone: string
}
const tableData = ref<Ticket[]>([
  {
    id: 1,
    workSN: 'KC00000001',
    workType: 0,
    workStatus: 0,
    workName: '某某项目勘察工单',
    workTime: '',
    workUser: ['张三', '李四'],
    address: '江苏省苏州市太仓市某某某小区',
    isStart: true,
    client: '某某人',
    phone: '188888888888'
  },
  {
    id: 2,
    workSN: 'SG00000002',
    workType: 1,
    workStatus: -1,
    workName: '某某项目勘察工单',
    workTime: '',
    workUser: ['张三', '李四'],
    address: '江苏省苏州市太仓市某某某小区',
    isStart: false,
    client: '某某人',
    phone: '188888888888'
  }
])
const handleScrollToLower = () => {
  console.log('scrolltolower')
}
</script>

<style lang="scss" scoped></style>
